package com.iflytek.management.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.iflytek.management.pojo.Department;

public interface DepartmentMapper {
	//通过id删除部门（假删除）
	@Update("update  Department  set isdelete=1 where depid=#{depid}")
    int deleteByPrimaryKey(Integer depid)throws Exception;
	
	//添加新部门
	@Insert("insert into Department(depid,depname,depmanager,description,isdelete) "
			+ "values(#{depid},#{depname},#{depmanager},#{description},0)")
    int insert(Department record)throws Exception;

//    int insertSelective(Department record);
    
    //通过id查询部门信息
    @Select("select * from Department where depid=#{depid} and isdelete=0")
    Department selectByPrimaryKey(Integer depid)throws Exception;

    //查询全部部门信息
    @Select("select * from Department where isdelete=0")
  	List<Department> selectAll()throws Exception;
  	
//    int updateByPrimaryKeySelective(Department record);
    
    //通过id修改部门信息
    @Update("update  Department  set depname = #{depname}, depmanager = #{depmanager},description = #{description} "
    		+ "where depid = #{depid}")
    int updateByPrimaryKey(Department record)throws Exception;
}